package xyz.xtt.asset.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.extern.slf4j.Slf4j;
import xyz.xtt.asset.service.ITblCollectionService;
import xyz.xtt.asset.vo.CollectionVo;
import xyz.xtt.asset.vo.HomeTopResponse;
import xyz.xtt.asset.vo.QueryCollType;
import xyz.xtt.common.response.ApiResult;

@Slf4j
@Schema(name = "nft风络", description = "nft风络")
@RestController
@RequestMapping("/api/nft/asset/collection")
public class CollectionController {
	@Autowired
	private ITblCollectionService iTblCollectionService;

	@Operation(summary = "用户风格列表和类型列表")
	@GetMapping("/type")
	public ApiResult<QueryCollType> type(@RequestHeader("uid") String uid) {
		log.info("/api/exchange/list list uid:{}", uid);
		QueryCollType query = iTblCollectionService.createQuery(uid);
		return ApiResult.ok(query);
	}

	@Operation(summary = "置顶风格列表")
	@GetMapping("/homeTop")
	public ApiResult<List<HomeTopResponse>> homeTop(@RequestHeader("uid") String uid) {
		log.info("/api/exchange/homeTop list uid:{}", uid);
		List<HomeTopResponse> query = iTblCollectionService.homeTop();
		return ApiResult.ok(query);
	}

	@Operation(summary = "获取风格列表")
	@GetMapping("/get_list")
	public ApiResult<List<CollectionVo>> list() {
		return ApiResult.ok(iTblCollectionService.getListAll());
	}
}
